﻿using ConfExpert.Forms.Base;
using DevTeam;

using System;
using System.Data;

namespace ConfExpert.Forms.Depo
{
    public partial class KatalogLinesSec : XForm
    {
        int KatalogId, KartelaLinesId;
        public KatalogLinesSec(int KatalogId, int KartelaLinesId)
        {
            InitializeComponent();
            this.KatalogId = KatalogId;
            this.KartelaLinesId = KartelaLinesId;
        }

        private void KatalogLinesSec_Load(object sender, EventArgs e)
        {
            
            
            gridView1.Init("GetKatalogThumb", KatalogId);
            gridView1.AddSummary("Parca");
            gridView1.BestFitColumns();

            gridView1.FocusedRowHandle = gridView1.LocateByValue(0, gridView1.Columns["KatalogLinesId"], KartelaLinesId);
            gridView1.MakeRowVisible(gridView1.FocusedRowHandle);

            gridView1.MakeReadOnly();
            gridView1.DoubleClick += gridView1_DoubleClick;
        }

        public int KatalogLinesId = 0;
        void gridView1_DoubleClick(object sender, EventArgs e)
        {
            DataRow r = gridView1.GetFocusedDataRow();
            if(r!=null)
                {
                    KatalogLinesId = r["KatalogLinesId"].ToInt();
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }
        }
    }
}
